package com.spddr.pmos.jpa;

import javax.persistence.Column;
import javax.persistence.Convert;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;

import org.joda.time.DateTime;
import org.joda.time.LocalDate;

import cn.seqdata.jpa.JpaNoGeneratedObject;

import com.fasterxml.jackson.databind.annotation.JsonSerialize;

@Entity
@Table(name = "trade_info")
public class Trade extends JpaNoGeneratedObject {
	private static final long serialVersionUID = 1L;

	private Program program;
	private Boolean test;
	private Integer status;
	private LocalDate startDate;
	private LocalDate endDate;
	private DateTime openTime;
	private DateTime closeTime;
	private DateTime clearTime;
	private DateTime pubTime;

	public Trade() {
		super();
	}

	public Trade(Long id) {
		super(id);
	}

	public Trade(Long id, String name) {
		super(id, name);
	}

	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "program")
	@JsonSerialize(using = cn.seqdata.jackson.ObjectSerializer.IdName.class)
	public Program getProgram() {
		return this.program;
	}

	public void setProgram(Program program) {
		this.program = program;
	}

	@Column(name = "is_test")
	public Boolean getTest() {
		return this.test;
	}

	public void setTest(Boolean test) {
		this.test = test;
	}

	@Column(name = "status")
	public Integer getStatus() {
		return this.status;
	}

	public void setStatus(Integer status) {
		this.status = status;
	}

	@Column(name = "start_date")
	@Convert(converter = cn.seqdata.jpa.converter.LocalDateConverter.class)
	public LocalDate getStartDate() {
		return startDate;
	}

	public void setStartDate(LocalDate startDate) {
		this.startDate = startDate;
	}

	@Column(name = "end_date")
	@Convert(converter = cn.seqdata.jpa.converter.LocalDateConverter.class)
	public LocalDate getEndDate() {
		return endDate;
	}

	public void setEndDate(LocalDate endDate) {
		this.endDate = endDate;
	}

	@Column(name = "open_time")
	@Convert(converter = cn.seqdata.jpa.converter.DateTimeConverter.class)
	public DateTime getOpenTime() {
		return this.openTime;
	}

	public void setOpenTime(DateTime openTime) {
		this.openTime = openTime;
	}

	@Column(name = "close_time")
	@Convert(converter = cn.seqdata.jpa.converter.DateTimeConverter.class)
	public DateTime getCloseTime() {
		return this.closeTime;
	}

	public void setCloseTime(DateTime closeTime) {
		this.closeTime = closeTime;
	}

	@Column(name = "clear_time")
	@Convert(converter = cn.seqdata.jpa.converter.DateTimeConverter.class)
	public DateTime getClearTime() {
		return this.clearTime;
	}

	public void setClearTime(DateTime clearTime) {
		this.clearTime = clearTime;
	}

	@Column(name = "pub_time")
	@Convert(converter = cn.seqdata.jpa.converter.DateTimeConverter.class)
	public DateTime getPubTime() {
		return this.pubTime;
	}

	public void setPubTime(DateTime pubTime) {
		this.pubTime = pubTime;
	}
}